package com.lightning.examples.dao;

import java.util.List;

import org.expressme.persist.MappedBy;
import org.expressme.persist.Param;
import org.expressme.persist.Query;
import org.expressme.persist.Unique;

import com.lightning.examples.model.mapper.UserDetailsRowMapper;
import com.lightning.web.support.security.context.UserDetails;

public interface UserDetailsDao {
	static final String USER_DETAILS_ALL = "u.login_id, u.name, u.mail, u.state";

	@Unique
	@MappedBy(UserDetailsRowMapper.class)
	@Query("select " + USER_DETAILS_ALL + " from user_details c where id=:id")
	UserDetails selectByPrimaryKey(@Param("id") int id);

	@MappedBy(UserDetailsRowMapper.class)
	@Query("select " + USER_DETAILS_ALL + " from user_details c where state = '1'")
	List<UserDetails> queryCategorys();
}
